#!/bin/bash

# This file is part of the SHACrypt test suite and is licensed
# under the same license as SHACrypt.

# Description:
# Make a file with a null byte, then 1024 random bytes. Attempt
# to encrypt and then decrypt it with the password "test"

echo "Test 3: Encryption and decryption of random data"

./test-helper rand3.tmp

$SHACRYPT e test rand3.tmp f3a.tmp
$SHACRYPT d test f3a.tmp f3b.tmp
result=$?

if [[ "$result" == "0" ]]
then cmp -s rand3.tmp f3b.tmp
	result=$?
fi

rm -f rand3.tmp f3a.tmp f3b.tmp

exit $result